package org.example.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface Shouchanmapper {

    /**
     * 收藏查询
     * @param id
     * @return
     */
    @Select("select id from shouchan where product_id=#{id} and username=#{username}")
    Object cx(int id,String username);

    /**
     * 新增
     *
     * @param id
     * @param username
     */
    @Insert("INSERT INTO shouchan (product_id,username)\n" +
            "VALUES\n" +
            "(#{id},#{username})")
    void xz(int id, String username);

    /**
     * 收藏删除
     * @param id
     */
    @Delete("delete from shouchan where product_id=#{id} and username=#{username}")
    void sc(int id ,String username);
    /**
     * 删除
     * @param
     */
    @Delete("delete from shouchan where  username=#{username}")
    void zx(String username);

    /**
     * 批量删除
     * @param id
     */
    @Delete("delete from shouchan where product_id=#{id} ")
    void scpl(int id);
}
